package com.qmq.config;

import com.qmq.app.config.WebMvcConfig;
import com.qmq.common.utils.PhotoUtils;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;

import javax.annotation.Resource;

@Configuration
public class ImoocMallWebMvcConfig extends WebMvcConfig {

    @Resource
    private PhotoUtils photoUtils;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //addResourceLocations 指的是文件放置的目录，addResoureHandler 指的是对外暴露的访问路径
        registry.addResourceHandler("/header/**")
                .addResourceLocations("file:" + photoUtils.getSavePath());
    }
}
